Skip to content

feat(cloudflare): Trace Clef calls in Workers AI as evaluate spans - #25027

Merged
JPeer264 merged 4 commits into
developfrom
jp/cloudflare-workers-ai-clef-test
Oct 7, 2026
Merged

JPeer264 merged 4 commits into
developfrom
jp/cloudflare-workers-ai-clef-test

Conversation

@JPeer264

@JPeer264 JPeer264 commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Cloudflare documents Clef (@cf/cloudflare/clef) as a drop-in for Jev with the same state + questions request shape. Released versions trace Clef as evaluate only because of that shape. #25033 now finds evaluation models by model ID, so without this change Clef calls would become chat spans. This adds the Clef model ID to the evaluate detection, plus a Clef integration test and a real-Worker E2E test.

The integration mock returns the documented Clef response, which has no { state, result } wrapper (the Jev binding response has one). That makes it cover the unwrapped branch of the evaluate response handling, which the Jev test does not reach. The E2E test calls the real model, so it is the one that confirms what the binding actually returns. The docs do not give a model value for the response, so it only asserts that it contains clef.

Fixes #25011

🤖 Generated with Claude Code

Cloudflare documents Clef as compatible with the Jev API, but only Jev
calls had tracing tests. The integration test mock returns the documented
Clef response, which has no `{ state, result }` wrapper, so it also covers
that branch of the evaluate response handling. The E2E test calls the real
model to verify the response shape that the binding returns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264
JPeer264 marked this pull request as ready for review October 5, 2026 06:24
@JPeer264
JPeer264 requested a review from a team as a code owner October 5, 2026 06:24
@JPeer264
JPeer264 requested review from andreiborza and mydea and removed request for a team October 5, 2026 06:24
@JPeer264 JPeer264 self-assigned this Oct 5, 2026
status: 'ok',
is_segment: false,
attributes: {
'sentry.origin': { value: 'auto.ai.cloudflare.workers_ai', type: 'string' },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: sentry.origin / sentry.op / sentry.is_localhost should all be in conventions so we could use the consts from there directly

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264
JPeer264 enabled auto-merge (squash) October 5, 2026 09:34
JPeer264 and others added 2 commits October 6, 2026 09:17
Trace `@cf/cloudflare/clef` calls as `evaluate` spans. Since evaluation
models are detected by model ID instead of the `state` + `questions`
input shape, Clef calls became `chat` spans.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264 JPeer264 changed the title test(cloudflare): Add Workers AI tracing tests for Clef feat(cloudflare): Trace Clef calls in Workers AI as evaluate spans Oct 6, 2026
@JPeer264
JPeer264 requested a review from nicohrubec October 6, 2026 07:24
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 29.6 kB - -
@sentry/browser - with treeshaking flags 27.75 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.65 kB - -
@sentry/browser (incl. Tracing) 51.52 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.52 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.5 kB - -
@sentry/browser (incl. Tracing, Replay) 91.14 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.12 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.83 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.83 kB - -
@sentry/browser (incl. Feedback) 47.12 kB - -
@sentry/browser (incl. sendFeedback) 34.65 kB - -
@sentry/browser (incl. FeedbackAsync) 39.76 kB - -
@sentry/browser (incl. Metrics) 30.61 kB - -
@sentry/browser (incl. Logs) 30.89 kB - -
@sentry/browser (incl. Metrics & Logs) 31.55 kB - -
@sentry/react 31.43 kB - -
@sentry/react (incl. Tracing) 53.84 kB - -
@sentry/vue 37.55 kB - -
@sentry/vue (incl. Tracing) 54.4 kB - -
@sentry/svelte 29.63 kB - -
@sentry/remix (Remix 3 client bundle) 55.85 kB - -
CDN Bundle 31.33 kB - -
CDN Bundle (incl. Tracing) 52.07 kB - -
CDN Bundle (incl. Logs, Metrics) 33.56 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.03 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.3 kB - -
CDN Bundle (incl. Tracing, Replay) 89.67 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.62 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.83 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.8 kB - -
CDN Bundle - uncompressed 92.46 kB - -
CDN Bundle (incl. Tracing) - uncompressed 154.77 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.04 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 160.72 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 228.66 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 274.58 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 280.52 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 288.28 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 294.21 kB - -
@sentry/nextjs (client) 56.19 kB - -
@sentry/sveltekit (client) 51.9 kB - -
@sentry/core/server 40.52 kB - -
@sentry/core/browser 13.51 kB - -
@sentry/node 145.02 kB +0.01% +4 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.22 kB - -
@sentry/node - without tracing 93.46 kB +0.01% +4 B 🔺
@sentry/node - without channel injection 123.17 kB +0.01% +5 B 🔺
@sentry/aws-serverless 101.69 kB +0.01% +1 B 🔺
@sentry/cloudflare (withSentry) - minified 209.08 kB +0.02% +41 B 🔺
@sentry/cloudflare (withSentry) 517.86 kB +0.03% +105 B 🔺

View base workflow run

andreiborza added a commit that referenced this pull request Oct 6, 2026
…s constant (#25070)

## What

Bugbot now flags attribute names and span ops written as strings (e.g.
`'sentry.origin'`) when `@sentry/conventions` has a constant for them.
The rule applies to SDK source and to tests.

## Why

Reviewers often have to point this out by hand, for example in
#25027 (comment).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264
JPeer264 merged commit c7ed7ca into develop Oct 7, 2026
524 of 528 checks passed
@JPeer264
JPeer264 deleted the jp/cloudflare-workers-ai-clef-test branch October 7, 2026 07:30
JPeer264 added a commit to getsentry/sentry-docs that referenced this pull request Oct 9, 2026
…on (#19877)

## DESCRIBE YOUR PR

This adds the Clef model (`@cf/cloudflare/clef`) to the Workers AI
evaluation section. Clef takes the same `state` and `questions` input as
Jev, so the SDK traces it as a `gen_ai.evaluate` span (by model ID since
getsentry/sentry-javascript#25027, SDK 11.5.0). The section anchor
changes, so this also updates the link from the TypeSafe page.

## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the
due date. You can update this information later by editing the PR
description.

- [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD
- [ ] Other deadline: YYYY-MM-DD
- [x] No deadline: Not urgent, can wait up to 1 week+

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
supplied a deadline.

Thanks in advance for your help!

## PRE-MERGE CHECKLIST

_Make sure you've checked the following before merging your changes:_

- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)

## LEGAL BOILERPLATE

<!-- Sentry employees and contractors can delete or ignore this section.
-->

Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.

## EXTRA RESOURCES

- [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Workers AI tracing test for Clef

3 participants